package com.songminju.jsong_httpserver;

import org.apache.log4j.Logger;

import com.songminju.jsong_httpserver.http.HttpRequest;
import com.songminju.jsong_httpserver.http.HttpResponse;
import com.songminju.jsong_httpserver.server.bio.BIOHttpServer;

public class App {
	public static void main(String[] args) {
		HttpServerConfig config = new HttpServerConfig();
		config.setHander(new HttpHandler() {
			private Logger logger = Logger.getLogger(this.getClass());
			@Override
			public void process(HttpRequest req, HttpResponse res) {
				logger.debug("process req:"+req+"res:"+res);
				res.println("hello-j");
				logger.debug("process finished");
			}
		});
		config.setMaxConnection(100);
		config.setMaxThread(20);
		config.setMinSpareThreads(2);
		config.setTimeout(3000);
		config.setPort(8081);
		httpServer httpServer = new BIOHttpServer(config);
		try {
			httpServer.startSync();
		} catch (Exception e) {		
			e.printStackTrace();
		}
	}
}
